﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ZX.Web.UI.Controls;
using ZX.CRM.Library;
using ZX.Web.UI.Controls.ControlBind;
using ZX.CRM.Bussiness;
using ZX.BLL;
using ZX.EHR.Library;
using ZX.SYS.Library;

namespace ZX.WebApp.Crm.Customer
{
    public partial class AddHistoryCustomer : EditUIPage
	{
        BTCrmCustomer bll = new BTCrmCustomer();
        BDatPhraseDetail bllDetail = new BDatPhraseDetail();
		protected void Page_Load(object sender, EventArgs e)
		{
            //省份
            IList<SysProvince> ListProvince = bll.GetAllProvince();
            DropDownListControl.DropDataSourceBind(this.Province, ListProvince, "Name", "Code");
            //虚拟部门
            IList<DatDepartment> ListDept = bll.GetVirtualDepartment(this.UserId);
            DropDownListControl.DropDataSourceBind(this.AreaId, ListDept, "DeptName", "DeptID");
            //客户规模(员工人数)
            IList<DatPhraseDetail> ListDetailNumber = bllDetail.GetDatPhraseDetailByClassValue("CustomerScope");
            DropDownListControl.DropDataSourceBind(this.PersonId, ListDetailNumber, "PhraseText", "PhraseID");
            //行业
            IList<DatPhraseDetail> ListDetailTrade = bllDetail.GetDatPhraseDetailByClassValue("Trade");
            DropDownListControl.DropDataSourceBind(this.TradeId, ListDetailTrade, "PhraseText", "PhraseID");
            //产值
            IList<DatPhraseDetail> ListDetailProduct = bllDetail.GetDatPhraseDetailByClassValue("Product");
            DropDownListControl.DropDataSourceBind(this.ProductId, ListDetailProduct, "PhraseText", "PhraseID");
            //公司性质
            IList<DatPhraseDetail> ListDetailProperty = bllDetail.GetDatPhraseDetailByClassValue("Property");
            DropDownListControl.DropDataSourceBind(this.PropertyId, ListDetailProperty, "PhraseText", "PhraseID");
            //客户级别
            IList<DatPhraseDetail> ListDetailLevel = bllDetail.GetDatPhraseDetailByClassValue("CustomerLevel");
            DropDownListControl.DropDataSourceBind(this.LevelId, ListDetailLevel, "PhraseText", "PhraseID");

            //新增信息
            if (DataAction == "insert")
            {
                this.ID.Value = Guid.NewGuid().ToString();
                this.Code.Value = IDMaker.GetSequenceStr("CUS001");
            }
            else  //编辑信息
            {

            }
		}

        /// <summary>
        /// 页面标题
        /// </summary>
        public string PageTitle
        {
            get { return this.GetStringFromQueryString("title", ""); }
        }
        /// <summary>
        /// 状态
        /// </summary>
        public string Flag
        {
            get { return this.GetStringFromQueryString("flag", ""); }
        }
        /// <summary>
        /// 获取类型
        /// </summary>
        public string Type
        {
            get { return this.GetStringFromQueryString("type", ""); }
        }
	}
}